<template>
  <el-dialog width="66%" :title="dialogTitle" v-model="dialogVisible" modal @close="closeDialog" draggable
    :close-on-click-modal="false" :append-to-body="true">
    <el-descriptions class="margin-top" title="操作信息" :column="3" border>
      <el-descriptions-item>
        <template #label>
          <i class="el-icon-user"></i>
          操作人
        </template>
        {{ formData.userName }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template #label>
          <i class="el-icon-time"></i>
          操作日期
        </template>
        {{ formData.optTime }}
      </el-descriptions-item>

      <el-descriptions-item>
        <template #label>
          <i class="el-icon-location-outline"></i>
          IP
        </template>
        {{ formData.ip }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template #label>
          <i class="el-icon-tickets"></i>
          操作模块
        </template>
        <el-tag> {{ formData.model }}</el-tag>
      </el-descriptions-item>
      <el-descriptions-item>
        <template #label>
          <i class="el-icon-chat-line-round"></i>
          操作内容
        </template>
        {{ formData.content }}
      </el-descriptions-item>
    </el-descriptions>
    <div slot="footer" class="dialog-footer">
      <el-button @click="closeDialog" size="mini">关 闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { getInfo } from '@/api/sys/optLog'

export default {
  name: 'optLogDialog',
  data() {
    return {
      type: '',
      dialogTitle: '',
      dialogVisible: false,
      formData: {},
      formDisabled: false,
      formRules: {},
    }
  },
  created() { },
  methods: {
    show(row) {
      this.formDisabled = true
      this.dialogTitle = '查看'
      getInfo(row.logId)
        .then((res) => {
          if (res.data.code === 200) {
            this.formData = res.data.data
            this.dialogVisible = true
          } else {
            this.$message.error(res.data.message)
          }
        })
        .catch((err) => {
          this.$message.error(err)
        })
    },
    closeDialog() {
      this.dialogVisible = false
    },
  },
}
</script>

<style scoped>
.dialog-form {
  padding: 0 30px;
  /* 根据需求调整数值 */
}
</style>
